package com.imooc.business.core.executor.query.base.chart;//package com.imooc.business.core.executor.query.base.chart;
//
//import cn.mashang.report.modules.query.business.constant.GraphFlag;
//import cn.mashang.report.modules.query.business.constant.OrganType;
//import cn.mashang.report.modules.query.business.constant.RealType;
//import cn.mashang.report.modules.query.helper.ChartType;
//import cn.mashang.report.modules.query.infra.repository.designer.base.ReportChartResultRespository;
//import cn.mashang.report.modules.query.infra.repository.designer.request.SupportTypeRequest;
//import cn.mashang.report.modules.query.infra.repository.designer.request.TableExecRequest;
//import cn.mashang.report.modules.query.request.QueryExectRequest;
//import cn.mashang.vxiao.modules.group.GroupUserRelation;
//import cn.mashang.vxiao.modules.group.IGroupUserRelationService;
//import org.apache.commons.compress.utils.Lists;
//import org.apache.dubbo.config.annotation.DubboReference;
//import org.springframework.stereotype.Repository;
//
//import java.util.List;
//import java.util.Map;
//import java.util.stream.Collectors;
//
///**
// * @Description: 用户榜单
// * @Author guyuefeng
// * @Date: 2022-10-20 10:25
// */
//@Repository
//public class ReportRealChartRankUserResultRespository extends ReportChartResultRespository<GroupUserRelation,Long> {
//
//    @DubboReference(check = false)
//    private IGroupUserRelationService groupUserRelationService;
//
//    protected List<GroupUserRelation> getOrganList(TableExecRequest request){
//        String groupId = request.getGroup().getGroupId();
//        //排除当前群组设置为示范数据的群组
//        boolean b = judgeCurrentUserDemonstrateFlag(groupId, false, request.getAppId());
//        if (b){
//            return Lists.newArrayList();
//        }
//        List<GroupUserRelation> relations = groupUserRelationService.listGroupUserRelation(groupId);
//        return relations;
//    }
//
//    /**
//     * 获取指标数据
//     * @author: guyuefeng
//     * @date: 2022/10/19 16:45
//     */
//    @Override
//    protected Map<Object, Map<String, Object>> getDataMap(TableExecRequest request, List<GroupUserRelation> relations){
//        Map<Object, Map<String, Object>> dataMap = execQuery(QueryExectRequest.builder().
//                        userIds(relations.stream().map(GroupUserRelation::getUserId).collect(Collectors.toList())).build(),
//                request.getStartDate(), request.getEndDate(), request.getTimeType(), request.getRuleSign(),
//                request.getIndexSigns(), request.getPageSize(), request.getOffset());
//        return dataMap;
//    }
//
//    @Override
//    protected String getName(GroupUserRelation user) {
//        return user.getName();
//    }
//
//    @Override
//    protected Long getOrganId(GroupUserRelation user) {
//        return user.getUserId();
//    }
//
//    @Override
//    protected String getOrganPhoto(GroupUserRelation organ) {
//        return organ.getAvatar();
//    }
//
//    @Override
//    protected Boolean supportRun(ChartType chartType) {
//        return ChartType.CHART_LIST.equals(chartType);
//    }
//
//    @Override
//    public Boolean supportType(SupportTypeRequest supportTypeRequest) {
//        return OrganType.USER.equals(supportTypeRequest.getOrganType()) &&
//                RealType.REAL.equals(supportTypeRequest.getRealType()) &&
//                GraphFlag.CHART.equals(supportTypeRequest.getGraphFlag());
//    }
//}
